//
//  OADTConfigViewController.m
//  OASDK_Works
//
//  Created by ChenJie on 3/31/20.
//  Copyright © 2020 Mist. All rights reserved.
//

#import "OADTConfigViewController.h"
#import "OASDK.h"
#import "OADefaultCell.h"
#import "OADMocker.h"
#import "OATableConfigHeader.h"

@interface OADTConfigViewController ()

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation OADTConfigViewController

#pragma mark - ViewController lifecycle

- (instancetype)init {
    self = [super init];
    if (self) {
        [self buildDataSource];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = NSStringFromClass(self.class);
    
    [self.view addSubview:self.tableView];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}

- (void)viewWillLayoutSubviews {
    [super viewWillLayoutSubviews];
}

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    
    CGFloat topMark = 0;
    CGSize viewSize = self.view.bounds.size;
    
    self.tableView.frame = CGRectMake(0, topMark, viewSize.width, viewSize.height - topMark);
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleLightContent;
}

#pragma mark - Public methods



#pragma mark - Private methods

- (void)buildDataSource {
    
    for (NSInteger i = 0; i < 10; i++) {
        OACellConfig *cellConfig = [[OACellConfig alloc] init];
        cellConfig.cellClass = OADefaultCell.class;
        
        OADefaultCellViewModel *cellViewModel = [OADefaultCellViewModel new];
        cellViewModel.title = [OADMocker mockTitle];
        cellViewModel.content = [OADMocker mockContent];
        cellConfig.cellViewModel = cellViewModel;
        
//        [self.tableView.oa_tableConfig addCellWithType:@"OADefaultCell" viewModel:cellViewModel];
        
        [self.tableView.oa_tableConfig addCell:cellConfig];
    }
    
    
    
    
//    OASectionConfig *section_1  = [[OASectionConfig alloc] init];
//
//    for (NSInteger i = 0; i < 10; i++) {
//        OACellConfig *cellConfig = [[OACellConfig alloc] init];
//        cellConfig.cellClass = OADefaultCell.class;
//
//        OADefaultCellViewModel *cellViewModel = [OADefaultCellViewModel new];
//        cellViewModel.title = [OADMocker mockTitle];
//        cellViewModel.content = [OADMocker mockContent];
//        cellConfig.cellViewModel = cellViewModel;
//
//        [section_1 addCellConfig:cellConfig];
//    }
//
//    [self.tableView.oa_tableConfig addSectionConfig:section_1];
}

#pragma mark - Event response methods



#pragma mark - Deletate methods



#pragma mark - Setter



#pragma mark - Getter

//OAGetTableView(tableView)
OAGetGroupedTableView(tableView)

#pragma mark - Memory management

- (void)dealloc {
}

@end
